<template>
  <div class="container-work">
    <div class="left-arrow" @click="arrowClick('left')"></div>
    <el-carousel ref="cardShowRef" :autoplay="false" arrow="never">
      <el-carousel-item v-for="(company, ind) in companyList" :key="ind">
        <div class="flex-box">
          <div
            v-for="(item, index) in company"
            class="swiper-item"
            :key="index"
          >
            <div class="icon">{{ item.id }}</div>
            <div class="layout">
              <span class="work-title">
                {{ item.companyName }}
              </span>
              <ul class="member-info">
                <li v-for="(m, i) in item.members" :key="i">
                  <span class="label">{{ m.label }}</span
                  ><span class="label anti-black">{{ m.name }}</span>
                </li>
              </ul>
            </div>
          </div>
        </div>
      </el-carousel-item>
    </el-carousel>

    <div class="right-arrow" @click="arrowClick('right')"></div>
  </div>
</template>
<script setup>
import { defineProps, ref } from 'vue'
defineProps({
  companyList: {
    type: Array,
    required: true
  }
})

const cardShowRef = ref(null)

const arrowClick = val => {
  if (val === 'right') {
    cardShowRef.value.next()
  } else {
    cardShowRef.value.prev()
  }
}
</script>
<style scoped lang="less">
.flex-box {
  display: flex;
  justify-content: space-between;
  padding-top: 7px;
  padding-left: 14px;
}
.container-work {
  position: relative;
  flex-flow: row nowrap;
  width: 628px;
  height: 252px;
  margin-left: 61px;
  .left-arrow {
    position: absolute;
    left: -45px;
    top: 70px;
    width: 28px;
    height: 45px;
    background: url(@/assets/images/hover-left-arrow.png) no-repeat;
    background-size: cover;
    cursor: pointer;
  }
  .right-arrow {
    position: absolute;
    right: -45px;
    top: 70px;
    width: 28px;
    height: 45px;
    background: url(@/assets/images/hover-right-arrow.png) no-repeat;
    background-size: cover;
    cursor: pointer;
  }
}
:deep(.el-carousel__indicators--horizontal) {
  display: none;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
}

:deep(.el-carousel__container) {
  height: 300px;
  width: 628px;
  height: 252px;
  position: relative;
}

ul {
  margin: 0;
  margin-top: 20px;
  padding: 0;
  line-height: 36px;
}

li {
  display: flex;
  list-style: none;
}
.anti-black {
  color: rgba(255, 255, 255, 1);
}
.label {
  display: flex;
  justify-content: space-between;
  width: 90px;
  margin-right: 8px;
  opacity: 1;
  color: rgba(154, 209, 255, 1);
  font-family: Source Han Sans;
  font-size: 20px;
  line-height: 32px;
  letter-spacing: 0;
  text-align: left;
}
.swiper-item {
  position: relative;
  width: 280px;
  height: 243px;
  background: url(@/assets/images/back.png) no-repeat;
  background-size: 280px 243px;

  .icon {
    position: absolute;
    width: 45px;
    height: 31px;
    top: -7px;
    left: -14px;
    opacity: 1;
    color: rgba(2, 39, 81, 1);
    font-family: Source Han Sans SC;
    font-weight: medium;
    font-size: 20px;
    line-height: 20px;
    letter-spacing: 0px;
    text-align: center;
    line-height: 31px;
    opacity: 1;
    border-radius: 15.4px;
    background: rgba(24, 175, 117, 1);
  }

  .layout {
    padding: 14px 28px 0 28px;

    .work-title {
      display: block;
      width: 241px;
      opacity: 1;
      color: rgba(154, 209, 255, 1);
      font-family: Source Han Sans;
      font-weight: bold;
      font-size: 24px;
      line-height: 32px;
      letter-spacing: 0px;
      text-align: left;
    }

    .member-info {
      width: 244px;
      height: 144px;
    }
  }
}
</style>
